package com.zeldu.myclass.service.impl;

import com.zeldu.myclass.mapper.DepartmentMapper;
import com.zeldu.myclass.pojo.Department;
import com.zeldu.myclass.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepartMentServiceImpl implements DepartmentService {
    private static final long serialVersionUID = 1L;

    @Autowired(required = false)
    private DepartmentMapper departmentMapper;

    @Override
    public List<Department> getDepartments() {
        return departmentMapper.getDepartments();
    }

    @Override
    public int addDepartment(Department department) {
        return departmentMapper.insert(department);
    }

    @Override
    public int deleteDepartment(Long id) {
        return departmentMapper.deleteById(id);
    }
}
